using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DocLibApp
{
    public partial class FormDatabaseEdit : Form
    {
        private string sDataTableName = "";

        public FormDatabaseEdit()
        {
            InitializeComponent();
        }

        public void EditTable(string tablename)
        {
            this.sDataTableName = tablename;

            OpenDataTable();
        }

        private void OpenDataTable()
        {
            FormMain.DocLib_QB.TableName = sDataTableName;

            //get primary key fields
            List<string> PrimaryKeyFields = FormMain.DocLib_SQLite.GetPrimaryKeyFieldsForTable(sDataTableName);

            FormMain.DocLib_QB.Get_Select(new System.Collections.Hashtable());
            System.Collections.ArrayList alist = FormMain.DocLib_QB.GetDataRow_ArrayList(true);

            lsv_Data.ShowData(alist, PrimaryKeyFields);
        }
    }
}